import { v4 as uuidv4 } from 'uuid';

/**
 * 生成带-的uuid
 * @description 生成的UUID是带-的字符串，类似于：9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d
 */
function randomUUID() {
  return uuidv4();
}

/**
 * 生成不带-的uuid
 * @description 生成的是不带-的字符串，类似于：9b1deb4d3b7d4bad9bdd2b0d7b3dcb6d
 */
function simpleUUID() {
  return uuidv4().replace(/-/g, '');
}

/**
 * 生成uuid
 * @param replace 是否替换 -
 * @default true
 */
export const uuid = {
  randomUUID,
  simpleUUID,
};
